<template>
  <div class="payment-return-container">
    <el-result
      icon="success"
      title="支付成功"
      subTitle="正在跳转到订单详情..."
    >
      <template #extra>
        <el-button type="primary" @click="goToOrderDetail">立即查看</el-button>
      </template>
    </el-result>
  </div>
</template>

<script setup>
import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';

const route = useRoute();
const router = useRouter();

const goToOrderDetail = () => {
  router.push(`/order/detail/${route.query.out_trade_no}`);
};

onMounted(() => {
  // 自动跳转
  setTimeout(() => {
    goToOrderDetail();
  }, 2000);
});
</script>